package demo6;

public class Singleton {
    //1.构造器私有化
    private Singleton(){}
    //2.定义一个静态的当前类型的属性，并初始化
    private static Singleton instance = new Singleton();
    //3.提供一个静态的公共方法，返回当前类型对象
    public static Singleton getInstance(){
        return instance;
    }
}
